function Search_box(obj){
	document.onselectstart = function(){return false;};//禁止选中文本。
	document.getElementById('map').onclick=function(){
		var t = document.getElementById('search_condition');
		t.style.display='none';/*初始化图例(hide)*/
	};

	/*-搜索数据展示-*/
	this.Show_data={
		gonglu:{ 
			'道路编码':'roadcode',
			'道路名称':'roadname',
			'道路起点':'startname',
			'道路终点':'endname'
		},
		qiaoliang:{   
			'桥梁编码':'qlcode',
			'桥梁名称':'name'
		},
		suidao:{  
			'隧道编码':'sdcode',
			'隧道名称':'name'
		}		
	};
	/*-搜索参数容器（编码）-*/
	this.Show_data_code={
			gonglu:['roadcode'],
			qiaoliang:['qlcode'],
			suidao:['sdcode']
	}
	/*-数据暂存/定时器 容器-*/
	this.mainContainer=[];
	this.viceContainer=[];
	this.timer=null;
	this.loadingJudge = false;
	this.sreachss = ['gonglu'];

	/*-Function()-*/
	var _this=this;
	this.main=document.getElementById(obj);				//获取目标元素
	this.create(this.main);									
	this.textChange(									//输入框监听、快捷搜索、初始化
						_this,
						this.oInput_box,
						this.oClear_btn,
						this.oScreening_condition
					);									
	this.buttonSearch(									//点击搜索
						_this,
						this.oInput_box,
						this.oButton
					);									
};
Search_box.prototype={
	/*----页面构造区----*/

	//create
	create:function(cre){
		//--搜索框容器--
		this.oContainer=this.createElement('div','search');
		//--input--
		this.oInput_box=this.createElement('input','inputBox','text','请输入公路、桥梁、隧道');
		//--clear--
		this.oClear_btn=this.createElement('div','clearButton');
		this.oClear_btn.title='初始化';
		this.oClear_btn.className='on';
		//--button--
		this.oButton=this.createElement('button','searchButton');
		//--addElement--
		this.oContainer.appendChild(this.oInput_box);
		this.oContainer.appendChild(this.oClear_btn);
		this.oContainer.appendChild(this.oButton);

		//--筛选条件容器--
		this.oCondition=this.createElement('ul','search_condition');
		this.oCondition.innerHTML='<li data-code="gonglu"><i class="gl"></i>公路</li><li data-code="qiaoliang"><i class="ql"></i>桥梁</li><li data-code="suidao"><i class="sd"></i>隧道</li>';
		this.oScreening_condition=this.createElement('div','screening');
		//--数据展示--
		this.oData_show=this.createElement('ul','data_show');
		this.oData_show_c=this.createElement('div','data_show_c');
		this.oPagerC=this.createElement('div');
		//--addElement--
		this.oData_show.appendChild(this.oData_show_c);
		this.oData_show.appendChild(this.oPagerC);
		this.oScreening_condition.appendChild(this.oData_show);

		//--整合容器--
		this.oPackage=this.createElement('div','package');
		//--addElement--
		this.oPackage.appendChild(this.oContainer);
		this.oPackage.appendChild(this.oCondition);
		this.oPackage.appendChild(this.oScreening_condition);

		//--target.add_all--
		cre.appendChild(this.oPackage);
	},

	/*----流程控制区----*/

	//输入框监听、快捷搜索、初始化
	textChange:function(_this,oInput_box,oClear_btn,oSearch_container){
		//--文字监听--
		oInput_box.oninput=function(){
			if(oInput_box.value.length==0){
				oClear_btn.className='on';
				
				clearTimeout(_this.timer);
				_this.oData_show_c.innerHTML='';
				_this.oData_show.className='';
				_this.oData_show.style.height='auto';
				oSearch_container.className='';
				document.getElementById('search_condition').style.display='block';/*初始化图例(show)*/
				
			}else{
				oClear_btn.className='';
				
				if(_this.oData_show_c.innerHTML==''){
					oSearch_container.className='om';
				}

			}
		};
		//--清除文字--
		oClear_btn.onclick=function(e){
			removeAllLayer();//初始化
			if(oInput_box.value!=''){
				oInput_box.value='';
				oInput_box.focus();
				oClear_btn.className='on';
				
				clearTimeout(_this.timer);
				_this.oData_show_c.innerHTML='';
				_this.oData_show.className='';
				_this.oData_show.style.height='auto';
				oSearch_container.className='';
			};
			document.getElementById('search_condition').style.display='block';/*初始化图例(show)*/
			var t = document.getElementById('search_condition');
			for(var i=0;i<t.getElementsByTagName('li').length;i++)t.getElementsByTagName('li')[i].className='';
			var e = e || event;e.stopPropagation ? e.stopPropagation() : e.cancelBubble = !0;
		};
		//--搜索条件--
		oInput_box.onfocus=function(){
			if(!$(oSearch_container).hasClass('on'))
			var temp = document.getElementById('search_condition');
			if(temp){
				temp.style.display='block';//初始化图例(show)
				for(var i=0;i<temp.getElementsByTagName('li').length;i++){
					temp.getElementsByTagName('li')[i].className='';
				}				
			}
		};
		oInput_box.onclick=function(e){
			if(oInput_box.value==''){
				var judge = true;
				var t = document.getElementById('search_condition');
				for(var i=0;i<t.getElementsByTagName('li').length;i++){
					if(t.getElementsByTagName('li')[i].className=='on')judge=false;
				}
				
				if(judge){
					//----初始化专题地图 start----
					removeAllLayer();//初始化
					document.getElementById('ThematicMap').className='';
					document.getElementById('tic_img').className='';
					document.getElementById('tic_txt').className='';
					document.getElementById('ticContent').className='';
					var target = document.getElementById('ticContent');
					for(var j=0;j<target.getElementsByTagName('div').length;j++){
						target.getElementsByTagName('li')[j].className='';
						target.getElementsByTagName('div')[j].style.height='0';
					}
					document.getElementById('Legend').style.display='none';//初始化图例
					document.getElementById('zb_dataShow').className="";//gis底部表格隐藏
					document.getElementById('echartsShow').className='';//echarts hide
					//初始化大标题
					$(".gis_title").fadeOut(300);
				}
				
			}
			//----初始化专题地图 end----
			var e = e || event;e.stopPropagation ? e.stopPropagation() : e.cancelBubble = !0;
		};
		//--父类交互--
		var tempTarget = document.getElementById('search_condition');
		var oLi = tempTarget.getElementsByTagName('li');
		for(var i=0;i<oLi.length;i++){
			oLi[i].index=i;
			oLi[i].onclick=function(){
				
				//--样式--
				for(var j=0;j<oLi.length;j++)oLi[j].className='';this.className='on';
				
				//--输入框默认值--
				oClear_btn.className='';
				switch(this.index){
					case 0: oInput_box.value='公路' ;break;
					case 1: oInput_box.value='桥梁' ;break;
					case 2: oInput_box.value='隧道' ;break;
				}
				
				////列表相关=======================================
				if($('#cy_pager')){$('#cy_pager').hide();}//分页隐藏
				_this.oScreening_condition.className='on om';
				_this.oData_show.style.height='auto';
				_this.oData_show.className='on';
				_this.oData_show_c.innerHTML='';
				_this.oData_show_c.innerHTML='<div class="la-ball-climbing-dot la-2x"><div></div><div></div><div></div><div></div></div><p style="color:#3385FF;text-align:center;font-size:12px;line-height:16px;">加载中...</p>';
				
				
				_this.sreachss[0]=this.getAttribute("data-code");
				searchAll(this.getAttribute("data-code"),function(result){
					//console.log(result)
					_this.RenderData(_this,null,null,result);//调用data_show
				})
				
				document.getElementById('search_condition').style.display='none';//初始化图例(hide)
			};
		};
		
		//--Enter快捷查询--
		oInput_box.onkeydown=function(ev){
			var oEvent = ev||event;
			if(oEvent.keyCode==13&&oInput_box.value.length!=0){
				_this.DataInteraction(_this,null,null,oInput_box.value);
				_this.oData_show.className='';
				document.getElementById('search_condition').style.display='none';//初始化图例(hide)
			}
		};
	},
	//点击searchButton搜索
	buttonSearch:function(_this,oInput_box,oButton){
		oButton.onclick=function(){
			if(oInput_box.value.length!=0){
				_this.DataInteraction(_this,null,null,oInput_box.value);
				_this.oData_show.className='';
			}
		};
	},

	/*----函数封装区----*/

	//createElements
	createElement:function(TagName,id,style,val){
		var obj=document.createElement(TagName);
		if(!id&&!style&&!val){
			return obj;
		}else if(!style&&!val){
			obj.id=id;
			return obj;
		}else if(!val){
			obj.id=id;
			obj.type=style;
			return obj;
		}else{
			obj.id=id;
			obj.type=style;
			if(style=='text'){
				obj.placeholder=val;
			}else{
				obj.value=val;
			}
			return obj;
		}
	},
	//getStyle
	getStyle:function(obj,attr){
		if(obj.currentStyle){
			return obj.currentStyle[attr];
		}else{
			return getComputedStyle(obj,false)[attr];
		}
	},
	//addEvent
	oAddevent:function(obj,ev,fn){
		if(obj.attachEvent){
			obj.attachEvent('on'+ev,fn);
		}else{
			obj.addEventListener(ev,fn,false);
		}
	},
	//height_auto
	oHeight_auto:function(obj,_this){
		
		var targetH=$(_this.oPackage).height();
		
		function auto(obj){
			var windowH = document.documentElement.clientHeight;
			var signHeight = (targetH/windowH).toFixed(2);	
			obj.style.height=signHeight>0.80?(windowH-175)*6/7 +'px':'auto';
			_this.oData_show.style.marginLeft=signHeight>0.80?'2.5%':'1.5%';
		}
		
		auto(obj);
		window.onresize=function(){auto(obj);};
	},
	//搜索列表构造
	oPagerC_c:function(_this,result,re){
		var re = re*10;var ree = re;
			$('#cy_pager').hide();//分页隐藏
			
			if(_this.loadingJudge){
				_this.oScreening_condition.className='on om';
				_this.oData_show.style.height='auto';
				_this.oData_show.className='on';
				_this.oData_show_c.innerHTML='';
				_this.oData_show_c.innerHTML='<div class="la-ball-climbing-dot la-2x"><div></div><div></div><div></div><div></div></div><p style="color:#3385FF;text-align:center;font-size:12px;line-height:16px;">加载中...</p>';
			}
			
			clearTimeout(_this.timer);
			_this.timer=setTimeout(function(){
				
				if(!result){
					_this.oData_show_c.innerHTML='';
					_this.oData_show_c.innerHTML='<p style="font-size:12px;text-align:center;height:50px;line-height:50px;color:orange;">没查到相关信息！</p>';
				}else{
					var listNum = 0;
					_this.oData_show_c.innerHTML='';
					for(re; re<result.length;re++){
						if(re==(ree+10)){break;}
						
						var oresult_li=_this.createElement('li');
						oresult_li.setAttribute('data-sign',listNum);
						oresult_li.setAttribute('data-code',result[re][_this.Show_data_code[_this.sreachss[0]][0]]);
						oresult_li.setAttribute('data-code_',result[re].startname);
						//左侧序号
						var oresult_index=_this.createElement('div');
						oresult_index.className='li_index';
						oresult_index.innerHTML='<div class="li_index_ico">'+(listNum+1)+'</div>';
						//右侧内容
						var oresult_text=_this.createElement('div');
						oresult_text.className='li_text';
						
						for(var oresult_text_name in _this.Show_data[_this.sreachss[0]]){
							oresult_text_li=_this.createElement('div');
							oresult_text_li.className='li_text_list';
							oresult_text_li.innerHTML='<span class="lft">'+oresult_text_name+'：</span><span class="rgt">'+result[re][_this.Show_data[_this.sreachss[0]][oresult_text_name]]+'</span>';
							oresult_text.appendChild(oresult_text_li);
						}
						listNum++;
	
						//add
						oresult_li.appendChild(oresult_index);
						oresult_li.appendChild(oresult_text);
						_this.oData_show_c.appendChild(oresult_li);
						
						_this.RenderData_interactive(_this);//点击事件交互 调用
					}
					
					if(result.length>10){$('#cy_pager').show();}//分页显示
					
					_this.oHeight_auto(_this.oData_show,_this);//height_auto
					
				}
			},500);
		
	},

	/*----数据交互区----*/
	
	DataInteraction:function(_this,obj,oSec_judge,Fuzzy_search){

		if(Fuzzy_search)

		//模糊搜索
		{	
			removeAllLayer();//初始化
			
			if($('#cy_pager')){$('#cy_pager').hide();}//分页隐藏
			_this.oScreening_condition.className='on om';
			_this.oData_show.style.height='auto';
			_this.oData_show.className='on';
			_this.oData_show_c.innerHTML='';
			_this.oData_show_c.innerHTML='<div class="la-ball-climbing-dot la-2x"><div></div><div></div><div></div><div></div></div><p style="color:#3385FF;text-align:center;font-size:12px;line-height:16px;">加载中...</p>';
			
			
			//data_show、(ajax)
			searchRoadByText(_this.sreachss[0],Fuzzy_search,function(result){
				//console.log(result)
					_this.RenderData(_this,null,null,result);//调用data_show
			})
			
			
		}
	},

	//data_show、(ajax)
	RenderData:function(_this,mainContainer,viceContainer,result){
		
		_this.oPagerC_c(_this,result,0);
		$(_this.oPagerC).cypager({pg_size:10,pg_total_count:result.length,pg_nav_count:6,pg_call_fun: function(count) {
			_this.loadingJudge = true;
			_this.oPagerC_c(_this,result,count-1);
		}});
		$('#cy_pager').hide();//分页隐藏
		
	},
	//点击事件交互
	RenderData_interactive:function(_this){
		
		//子类交互
		for(var data_=0;data_<_this.oData_show_c.getElementsByTagName('li').length;data_++){
			_this.oData_show_c.getElementsByTagName('li')[data_].onclick=function(){
				for(var data_i=0;data_i<_this.oData_show_c.getElementsByTagName('li').length;data_i++){
					_this.oData_show_c.getElementsByTagName('li')[data_i].className='';
				}

				this.className='on';
				queryByCode(_this.sreachss[0],this.getAttribute('data-code'),this.getAttribute('data-code_'));

			};
		}
		
	}
};
var Search_box = new Search_box('SearchBox');